package com.leyou.seckill.client;

import com.leyou.seckill.dto.SeckillPolicyDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("seckill-service")
public interface SecKillClient {

    /**
     * 根据日期查询秒杀信息列表
     * @return
     */
    @GetMapping("/list/{date}")
    List<SeckillPolicyDTO> findSecKillPolicyListByDate(@PathVariable(name = "date")String date);
    /**
     * 根据id查询秒杀信息
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    SeckillPolicyDTO findSecKillPolicyById(@PathVariable(name = "id") Long id);

    /**
     * 减秒杀的库存
     * @param seckillId
     * @param i
     */
    @PutMapping("/minusStock")
    void minusStock(@RequestParam(name = "seckillid") Long seckillId
            ,@RequestParam(name = "num") int i);
}
